package cn.gs.meta.db.tables;

import java.util.HashMap;
import java.util.Map;
import javax.persistence.*;
import org.hibernate.annotations.Cascade;

// @author gs
@Entity
public class Ogn extends ModelBase {

    private long cash;
    private long monthCashTotal;
    @ElementCollection
    @MapKeyColumn(name = "model")
    @Column(name = "cnt")
    @CollectionTable(name = "keeps", joinColumns =
    @JoinColumn(name = "model"))
    @Cascade(value = {org.hibernate.annotations.CascadeType.ALL})
    private Map<ModelBase, Keep> keeps;

    public long getCash() {
        return cash;
    }

    public void setCash(long cash) {
        this.cash = cash;
    }

    public long getMonthCashTotal() {
        return monthCashTotal;
    }

    public void setMonthCashTotal(long monthCashTotal) {
        this.monthCashTotal = monthCashTotal;
    }

    public Map<ModelBase, Keep> getKeeps() {
        if (keeps == null) {
            keeps = new HashMap<>();
        }
        return keeps;
    }

    public void setKeeps(Map<ModelBase, Keep> keeps) {
        this.keeps = keeps;
    }
}
